﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ThePushCSharp
{
    public class Tile
    {
        public Entity unit;
        public Terrain terrain;
        public int friendlyUnitsInSightRange;

        public Tile(Terrain terrain)
        {
            unit = null;
            this.terrain = terrain;
            friendlyUnitsInSightRange = 0;
        }

        public Boolean canBeSeen()
        {
            return (friendlyUnitsInSightRange > 0);
        }

        public bool walkable()
        {
            if (unit == null && terrain.walkable)
                return true;
            else
                return false;
        }

        public bool passable(Troop troop)
        {
            if (walkable())
                return true;
            else if (troop.owner.isAlly(unit.owner) && terrain.walkable)
                return true;
            else 
                return false;
        }
    }
}
